<template>
  <div class="">
    <el-menu
        default-active="1"
        class="menu">
      <el-submenu :index="String(index+1)" v-for="(menu,index) in menuList">
        <template slot="title">
          <i :class="menu.icon"></i>
          <span >{{menu.title}}</span>
        </template>
        <el-menu-item-group>

          <el-menu-item :index="String(index+1)+'-'+String(i+1)" v-for="(item,i) in menu.child " @click="handleMenuClick(item)">
            {{item.title}}
          </el-menu-item>

        </el-menu-item-group>

      </el-submenu>

    </el-menu>
  </div>
</template>

<script>
export default {
  name: "LeftMenu",
  data() {
    return {
      menuList:[
        {
          title:"用户管理",
          icon:"el-icon-user-solid",
          child:[
            {
              title:"权限管理",
              to:"/bg/permission"
            },
            {
              title:"角色管理",
              to:"/bg/role"
            }
          ]
        },
        {
          title:"租房管理",
          icon:"el-icon-s-home",
          child:[
            {
              title:"公寓管理",
              to:"/bg/apartment"
            },
            {
              title:"房间管理",
              to:"/bg/room"
            },
            {
              title:"设施管理",
              to:"/bg/stuff"
            },
            {
              title:"费用管理",
              to:"/bg/feetype"
            },
            {
              title:"禁止事项",
              to:"/bg/forbid"
            },
            {
              title:"安全保障",
              to:"/bg/security"
            },
            {
              title:"取消策略",
              to:"/bg/cancel"
            }
          ]
        },
        {
          title: "地区管理",
          icon:"el-icon-location-information",
          child:[
            {
              title:"国家",
              to:"/bg/country"
            },
            {
              title:"城市",
              to:"/bg/city"
            },
            {
              title:"学校",
              to:"/bg/school"
            }
          ]
        },
        {
          title: "订单管理",
          icon:"el-icon-s-order",
          child:[
            {
              title:"全部订单",
              to:"/bg/order"
            },
          ]
        }
      ]
    }
  },
  methods: {
    handleMenuClick(menu){
      this.$router.push(menu.to)
    }
  }
}
</script>

<style scoped lang="less">

</style>